package com.dycong.common.Lamda;

import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * Created by Duke on 2016/12/7.
 */
public class RandomStream {


    public void t() {

        Double[] array = new Random().doubles(0, 350000).limit(350000).boxed().toArray(Double[]::new);
        List<Double> list = new Random().doubles(10000).boxed().collect(Collectors.toList());

        Random seed = new Random();
        Supplier<Integer> random = seed::nextInt;

        Stream.generate(random).limit(10).forEach(System.out::println);
        Stream.generate(random).limit(10).collect(Collectors.toList());
        Stream.generate(seed::nextInt).limit(10).collect(Collectors.toList());

        List list1 = Stream.generate(() -> seed.nextInt()).limit(10).collect(Collectors.toList());
        List list2 = Stream.generate(() -> {return new Random().nextInt();}).limit(10).collect(Collectors.toList());

        IntStream.generate(() -> (int) (System.nanoTime() % 100)).limit(10).forEach(System.out::println);
        int[] ints=IntStream.generate(() -> (int) (System.nanoTime() % 100)).limit(10).toArray();
    }
}
